fix(api): Map update order/collapsed to API field names#228
fix(api): Map update order/collapsed to API field names#228goncalossilva merged 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns SDK-level update parameters (order, collapsed) with the Todoist REST API’s expected payload field names to avoid naming conflicts while keeping the SDK interface ergonomic.
Changes:
- Map
order/collapsedto API fields (child_order/section_order,is_collapsed) when updating tasks, projects, and sections. - Extend
update_projectandupdate_sectionto supportorderandcollapsed. - Update test fixtures and add payload-mapping tests to validate the outgoing request JSON.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| todoist_api_python/api_async.py | Maps update payload fields and extends async project/section update parameters. |
| todoist_api_python/api.py | Maps update payload fields and extends sync project/section update parameters. |
| tests/test_models.py | Updates model parsing assertions to match current API response field names. |
| tests/test_api_tasks.py | Adds assertions verifying request payload mapping for task updates. |
| tests/test_api_sections.py | Adds assertions verifying request payload mapping for section updates. |
| tests/test_api_projects.py | Adds assertions verifying request payload mapping for project updates. |
| tests/data/test_defaults.py | Updates default API response fixtures to the newer field names used in responses. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Keep SDK parameters ergonomic by handling the mapping internally: - Map task/project update `order` -> `child_order` - Map section update `order` -> `section_order` - Map update `collapsed` -> `is_collapsed` (task/project/section)
e349317 to
4b890a1
Compare
There was a problem hiding this comment.
This update maps the order and collapsed fields to their respective API field names while maintaining consistent naming conventions within the SDK. The implementation enhances ergonomics and ensures the library remains intuitive to use, and no issues were flagged during the review.
chiara-doist
left a comment
There was a problem hiding this comment.
This looks good to me, I'm fine with the naming conventions as they are intentional. Nice work!
Follow-up to #223 and consequently Doist/Todoist#26685, Doist/Todoist#26686, and Doist/Todoist#26687.
This makes order/collapsed work without bumping into missing functionality or naming conflicts. I opted to keep
orderandcollapsedat the SDK level for better overall ergonomics and intra-SDK naming conventions.The changes themselves are tiny. Most of the diff is in testing, where we now more explicitly ensure mapping works.